home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 16
/
Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso
/
Aminet
/
util
/
batch
/
random.readme
< prev
next >
Wrap
Text File
|
1996-11-04
|
3KB
|
105 lines
Short: Output a random number for use in scripts, etc.
Author: krf101@york.ac.uk (Kevin Fairhurst)
Uploader: krf101@york.ac.uk (Kevin Fairhurst)
Type: util/batch
Usage:
The correct usage of 'Random' is to pass it a single argument. This value
is the maximum number you want considered i.e. that a random number will be
picked between 1 and this number.
For 'Random' to work correctly, the number MUST be between 1 and 65536.
Numbers outside this range (or failure to pass numbers, eg passing
a string of letters) will cause 'Random' to behave as outlined in the
examples that follow:
1> Random
outputs a number between 1 and 65536
2> Random 0
same as example 1
3> Random a (where 'a' is a positive integer between 1 and 65536 inclusive)
outputs a number between 1 and a
4> Random b (where 'b' is a positive integer greater than 65536)
outputs the number 1
5> Random c (where 'c' is any negative integer)
outputs c + 1
6> Random text
same as example 1
7> Random 123 456 789
outputs a number between 1 and the first argument (in this case 123)
8> Random "more text"
same as example 1
9> Random "123 456 789"
same as example 1
What you do once you have your random number is up to you. One idea is if
you want random backdrops. Say you have 5 different backdrop settings that
you wish to choose from at every boot. Save them to prefs/presets with
different filenames (WBPattern_1.prefs, etc. would be a good start). Then
edit 5 scripts in your S: drawer, named 1.bat to 5.bat.
Script 1.bat copies WBPattern_1.prefs to env:sys/WBPattern.prefs, and I
hope I don't have to tell you what 2.bat - 5.bat do ...
AFTER everything has been copied from ENVARC:SYS to ENV:SYS in your
startup-sequence, but before IPrefs is called, add the following lines:
Random 5 >ENV:WBP
Run <>NIL: Execute S:$WBP.bat
(For those who don't know, using <>NIL: is the same as using <NIL: >NIL:)
As long as you have 'Random' in your path somewhere, along with Run and
Execute, every time you boot your backdrop settings will be chosen randomly!
Other ideas are to incorperate the RequestChoice command to have a dead
good (honest!) game. See the file Game.bat which should have come with this
program for an example of this.
-->8--------------------------------------------------------------------8<--
If you wish to complain/comment/send cash then either email me at the
above address, or write to me at
Kevin Fairhurst
Goodricke College
University of York
Heslington
York
YO1 5DD
England
Also, check out my homepage on http://www.york.ac.uk/~krf101
============================= Archive contents =============================
Original Packed Ratio Date Time Name
-------- ------- ----- --------- -------- -------------
1226 570 53.5% 17-Sep-96 13:46:04 Game.bat
1256 953 24.1% 17-Sep-96 11:07:58 Random
2675 1245 53.4% 17-Sep-96 11:42:38 Random.readme
-------- ------- ----- --------- --------
5157 2768 46.3% 14-Oct-96 07:00:24 3 files